package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	SellOrderPaymentEventNew           = "erp.SellOrderPaymentNew"
	SellOrderPaymentEventBeforeCreate  = "erp.SellOrderPaymentBeforeCreate"
	SellOrderPaymentEventBeforeUpdate  = "erp.SellOrderPaymentBeforeUpdate"
	SellOrderPaymentEventBeforeSave    = "erp.SellOrderPaymentBeforeCreate erp.SellOrderPaymentBeforeUpdate"
	SellOrderPaymentEventAfterCreate   = "erp.SellOrderPaymentAfterCreate"
	SellOrderPaymentEventAfterUpdate   = "erp.SellOrderPaymentAfterUpdate"
	SellOrderPaymentEventAfterSave     = "erp.SellOrderPaymentAfterCreate erp.SellOrderPaymentAfterUpdate"
	SellOrderPaymentEventDelete        = "erp.SellOrderPaymentDelete"
	SellOrderPaymentAccessControlEvent = "erp.SellOrderPaymentAccessControl"
)

func GetSellOrderPaymentConfig() *mgo.DocConfig {
	return SellOrderPayment_Config
}

var SellOrderPayment_Config *mgo.DocConfig

func init() {
	SellOrderPayment_Config = NewSellOrderPaymentConfig()
}
func NewSellOrderPaymentConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "erp.SellOrderPayment",
		Fields: []string{
			"belongTo", "type", "money", "applyEmp", "payAt", "payFeed", "payEmp", "isPay", "isLock",
		},
		RelationFields: []string{
			"belongTo", "type", "applyEmp", "payEmp",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"belongTo": {
				Config:     GetSellOrderConfig,
				DocName:    "SellOrder",
				JoinType:   "O",
				KeyInside:  "belongToId",
				KeyOutSide: "id",
			},
			"type": {
				Config:     GetSellOrderPayTypeConfig,
				DocName:    "SellOrderPayType",
				JoinType:   "O",
				KeyInside:  "typeId",
				KeyOutSide: "id",
			},
			"applyEmp": {
				Config:     GetEmpConfig,
				DocName:    "Emp",
				JoinType:   "O",
				KeyInside:  "applyEmpId",
				KeyOutSide: "id",
			},
			"payEmp": {
				Config:     GetEmpConfig,
				DocName:    "Emp",
				JoinType:   "O",
				KeyInside:  "payEmpId",
				KeyOutSide: "id",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
